var t = function (t) {
  return t && t.__esModule ? t : {
    default: t
  };
}(require("../../../../utils/toot.js")),
  o = getApp();

Page({
  data: {
    curHdIndex: 0,
    serviceFlag: !0,
    doctor: {
      jobType: 1,
      userIcon: '/assets/images/796.png',
      doctorName: '小明',
      nmDepartment: 123,
      nmHospital: 321,
      nmHospital: 456,
      teamHeaderUrl: '/assets/images/796.png',
      teamName: '小红',
      creater: {
        doctorName: '小强'
      }
    },
    cost: [{
      icon: '/assets/shop_images/pho.png',
      nmInterroga: '图片咨询',
      servicePrice: 50000,
      currentPrice: 10000,
      cdInterroga: 1
    },
    {
      icon: '/assets/shop_images/phone.png',
      nmInterroga: '电话咨询',
      servicePrice: 50000,
      currentPrice: 10000,
      cdInterroga: 2
    }
    ],
    relation: {
      freeState: 1
    },
    authStateBoo: !1
  },
  choose_type: function (t) {
    this.setData({
      curHdIndex: t.currentTarget.dataset.id
    });
  },
  goConsult: function (e) {
    // var o = this,
    //   e = t.currentTarget.dataset.id,
    //   n = t.currentTarget.dataset.index;
    // console.log(t), "290101" != e ? wx.showModal({
    //   content: "此功能暂未开通，敬请期待~",
    //   success: function(t) {
    //     t.confirm || t.cancel;
    //   }
    // }) : wx.navigateTo({
    //     url: "/hyb_yl/userShopping/pages/submitConsultation/submitConsultation?doctorId=" + o.data.doctorId + "&serviceId=" + o.data.cost[n].id + "&signType=" + o.data.signType
    // });
    let that = this;
    let id = e.currentTarget.dataset.id;
    let cost = that.data.cost;
    let curHdIndex = that.data.curHdIndex;
    cost.map(function (i) {
      if (i.cdInterroga == id) {
        let costs = wx.setStorageSync('costs', costs) || {}
        costs = i;
        wx.setStorageSync('costs', costs);
        console.log(i)
      }
    })
    if (curHdIndex == 0) {
      wx.navigateTo({
        url: "/hyb_yl/userShopping/pages/submitConsultation/submitConsultation"
      })
    } else {
      that.setData({
        modelBoo: !0
      })
    }
  },
  onLoad: function (e) {
    console.log(e)
    var n = this;
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    this.setData({
      signType: e.signType,
      signId: e.signId,
      doctorId: e.doctorId,
      token: wx.getStorageSync("logs")
    })
    let cdinterroga = e.cdinterroga;
    if (cdinterroga == 290101) {
      n.setData({
        curHdIndex: 0
      })
    } else {
      n.setData({
        curHdIndex: 1
      })
    }
    // , console.log(e.signType), 3 == e.signType ? n.setData({
    //   url: "team/sign/info/"
    // }) : n.setData({
    //   url: "patient/sign/doctorInfo/get/"
    // }), wx.showLoading({
    //   title: "加载中...",
    //   mask: !0
    // }), wx.request({
    //   url: o.globalData.patient + "patient/sign/getCost/" + n.data.doctorId + "/" + n.data.signId,
    //   success: function(t) {
    //     if (console.log(t), 10020112 != t.data.code) {
    //       if (200 == t.data.code) {
    //         var o = t.data.data.cost;
    //         o.length > 0 ? o.forEach(function(t) {
    //           "290101" == t.cdInterroga ? t.icon = "/assets/shop_images/pho.png" : "290102" == t.cdInterroga ? t.icon = "/assets/shop_images/phone.png" : "290104" == t.cdInterroga ? t.icon = "/assets/shop_images/video.png" : t.icon = "/assets/shop_images/private.png",
    //             t.serviceDesc && (t.serviceDesc = t.serviceDesc.split("|"));
    //         }) : n.setData({
    //           serviceFlag: !1
    //         }), n.setData({
    //           cost: o,
    //           relation: t.data.data.relation
    //         }), console.log(n.data.cost);
    //       }
    //     } else wx.showModal({
    //       title: "抱歉团队已解散",
    //       showCancel: !1,
    //       confirmText: "我知道了",
    //       confirmColor: "#3b4ca9",
    //       success: function(t) {
    //         t.confirm && wx.switchTab({
    //           url: "/pages/index/index"
    //         });
    //       }
    //     });
    //   },
    //   fail: function() {
    //     wx.showToast({
    //       title: "系统繁忙，请稍后再试",
    //       icon: "none",
    //       duration: 2e3
    //     });
    //   },
    //   complete: function() {
    //     wx.hideLoading();
    //   }
    // }), t.default.doctorIntro(n);
  },
  //看服务协议
  goProtocol: function () {
    wx.navigateTo({
      url: "/hyb_yl/userLife/pages/protocol/protocol"
    });
  },
  //关闭弹窗
  abolishBtn: function () {
    this.setData({
      modelBoo: !1
    });
  },
  //电话咨询
  signedBtn: function () {
    let authStateBoo = this.data.authStateBoo;
    if (authStateBoo == !0) {
      wx.navigateTo({
        url: "/hyb_yl/userShopping/pages/consultingPayments/consultingPayments"
      });
      this.setData({
        modelBoo: !1
      })
    } else {
      wx.showToast({
        title: "请同意惠邦肾服务协议",
        icon: "none",
        duration: 2e3
      })
    }
  },
  //授权
  checkboxChange: function (e) {
    let authStateBoo = this.data.authStateBoo;
    this.setData({
      authStateBoo: !authStateBoo
    })
  },
  onReady: function () { },
  onShow: function () { },
  onHide: function () { },
  onUnload: function () {
    wx.removeStorageSync("costData");
  },
  onPullDownRefresh: function () { },
  onReachBottom: function () { },
  onShareAppMessage: function () { }
});